<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<script>

       var str="1 plus 2 equals 3";
	//    var pattern=/\d/g;
	   var pattern=new RegExp("\d","mg");
	   console.log(pattern)
	    console.log(pattern.exec(str));
		console.log(str.match(pattern));
        console.log("1 plus 2 equals 3".match(/\d/g));

		var str1 = "1 hello"
		var pa = new RegExp("/d","gim")
		console.log(pa.exec(str1))



	    
	</script>









</head>
<body>
	
</body>
</html>